package com.credithc.eagleeye.demo.webservice;
import lombok.extern.slf4j.Slf4j;
import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
 * 描述：webservice发布者<br/>
 * 作者：sunyang
 * 创建：2019/5/23 16:10
 * 版本：v1.0.0<br/>
 */
@Slf4j
@Configuration
public class Publisher {
    @Bean
    public ServletRegistrationBean register() {
        return new ServletRegistrationBean(new CXFServlet(), "/demo/webservice/*");
    }

    @Bean(name = Bus.DEFAULT_BUS_ID)
    public SpringBus springBus() {
        return new SpringBus();
    }

    @Bean
    public SignService signService() {
        return new SignServiceImpl();
    }

    @Bean
    public EndpointImpl endpoint() {
        EndpointImpl endpoint = new EndpointImpl(springBus(), signService());
        endpoint.publish("/SignService");
        return endpoint;
    }
}
